package ovm.gui.views.administration.factory;

import ovm.gui.views.AbstractCatalogView;
import ovm.management.administration.factory.EntityFactoryManager;

/**
 * Created by IntelliJ IDEA.
 * User: Jokser
 * Date: 02.06.12
 * Time: 14:09
 * To change this template use File | Settings | File Templates.
 */
public class EntityFactoryView extends AbstractCatalogView {

    public EntityFactoryView(Class entityClass, Boolean editable) {
        super(entityClass, editable);
        setCaption("Настройка объектов отображения для сущностей");
    }

    @Override
    protected int addNewEntity() {
        return EntityFactoryManager.addDefaultEntity();
    }

    @Override
    protected void setContainerProperties() {
        entityContainer.addContainerProperty("id", Integer.class, null, true, true);
        entityContainer.addContainerProperty("entity", String.class, "Entity", true, true);
        entityContainer.addContainerProperty("entityView", String.class, "", true, true);
        entityContainer.addContainerProperty("entityListView", String.class, "", true, true);
        entityContainer.addContainerProperty("entityForm", String.class, "", true, true);
    }

    @Override
    protected void buildTable() {
        table.setVisibleColumns(new Object[]{"entity", "entityView", "entityListView", "entityForm"});
        table.setColumnWidth("entity", 200);
        table.setColumnWidth("entityView", 200);
        table.setColumnWidth("entityListView", 200);
        table.setColumnWidth("entityForm", 200);
    }
}
